#ifndef RULE_HPP_GUARD
#define RULE_HPP_GUARD

#include "literal.hpp"

namespace mashine { namespace kb {

/**
 * This class presetn rule in Horn-disjunctive form
 */
struct Rule : public Entity<Literal>
{
public:
	/**
	 * Don't call this constructor manualy
	 */
	Rule();
	Rule(std::vector<Literal> literals, std::string name = "empty");
	Rule(Rule const & rule);
	virtual ~Rule();
	
	/**
	 * setter method for set parameters 
	 */
	virtual void setParams(std::vector<Literal> params);
	
	/**
	 * return single undeniable literal
	 */
	Literal const * getUndeniableLiteral() const;

	/**
	 * set undeniable literal
	 */	
	void setUndeniableLiteral(Literal * undeniable);
	
	/**
	 * return string representation object
	 */
	virtual std::string toString() const;
	
	/**
	 * replace paramethers in same order as in undenied predicate 
	 */
	Rule operator()(const vector<string> & params) const;
	
protected:
	Literal * undeniable;					// impossible use variable instead pointer, 

	/**
	 * need owerride this method in child class 
	 * to correct work Entity constructor
	 */
	virtual bool validateName() const;
	
	/**
	 * need owerride this method in child class 
	 * to correct work Entity constructor
	 */
	virtual bool validateParam() const;
};

}}

#endif